package com.contract.common.enums;

import lombok.Data;

import java.util.HashMap;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 *
 * @author liw
 * @version 1.0
 * @date 2024/3/1 21:48
 */
public class FaceCheckCode {

    public static final Map<Integer, Node> CODE_MAP = new HashMap<>();

    static {
        CODE_MAP.put(2, new Node(2, "Service temporarily unavailable", "服务暂不可用", "服务暂不可用，请再次请求，如果持续出现此类错误，请在控制台提交工单联系技术支持团队"));
        CODE_MAP.put(4, new Node(4, "Open api request limit reached", "集群超限额", "集群超限额，请再次请求，如果持续出现此类错误，请在控制台提交工单联系技术支持团队"));
        CODE_MAP.put(6, new Node(6, "no permission to access data", "没有接口权限", "请确认您调用的接口已经被赋权；常见问题是有V3版本权限，调用的是v2版本接口；；需要企业认证的，开通企业认证后一个小时左右即可使用。"));
        CODE_MAP.put(17, new Node(17, "Open api daily request limit reached", "每天流量超限额", "免费测试资源使用完毕，每天请求量超限额，已支持计费的接口，您可以在控制台人脸识别选择购买相关接口的次数包或开通按量后付费；邀测和未支持计费的接口，您可以在控制台提交工单申请提升限额"));
        CODE_MAP.put(18, new Node(18, "Open api qps request limit reached", "QPS超限额", "可直接自助购买更多QPS、联系商务接口人、或者提交工单"));
        CODE_MAP.put(19, new Node(19, "Open api total request limit reached", "请求总量超限额", "免费测试资源使用完毕，每天请求量超限额，已支持计费的接口，您可以在控制台人脸识别选择购买相关接口的次数包或开通按量后付费；邀测和未支持计费的接口，您可以在控制台提交工单申请提升限额"));
        CODE_MAP.put(100, new Node(100, "Invalid parameter", "无效的access_token参数", "token拉取失败，可以参考“Access Token获取”重新获取"));
        CODE_MAP.put(110, new Node(110, "Access token invalid or no longer valid", "Access Token失效", "token有效期为30天，注意需要定期更换，也可以每次请求都拉取新token"));
        CODE_MAP.put(111, new Node(111, "Access token expired", "Access token过期", "token有效期为30天，注意需要定期更换，也可以每次请求都拉取新token"));
        CODE_MAP.put(222001, new Node(222001, "param[fieldName] is null", "必要参数未传入", "参考API说明文档，传入必须的fieldName字段"));
        CODE_MAP.put(222002, new Node(222002, "param[start] format", "参数格式错误", "参考API说明文档，修改参数；"));
        CODE_MAP.put(222003, new Node(222003, "param[length] format", "参数格式错误", "参考API说明文档，修改参数；"));
        CODE_MAP.put(222004, new Node(222004, "param[op_app_id_list] format error", "参数格式错误", "参考API说明文档，修改参数"));
        CODE_MAP.put(222005, new Node(222005, "param[group_id_list] format error", "参数格式错误", "参考API说明文档，修改参数"));
        CODE_MAP.put(222006, new Node(222006, "group_id format error", "参数格式错误", "参考API说明文档，修改参数"));
        CODE_MAP.put(222007, new Node(222007, "uid format error", "参数格式错误", "参考API说明文档，修改参数"));
        CODE_MAP.put(222008, new Node(222008, "face_id format error", "参数格式错误", "参考API说明文档，修改参数"));
        CODE_MAP.put(222009, new Node(222009, "quality_conf format", "参数格式错误", "参考API说明文档，修改参数；"));
        CODE_MAP.put(222010, new Node(222010, "user_info format error", "参数格式错误", "参考API说明文档，修改参数"));
        CODE_MAP.put(222011, new Node(222011, "param[uid_list] format error", "参数格式错误", "参考API说明文档，修改参数"));
        CODE_MAP.put(222012, new Node(222012, "param[op_app_id]", "参数格式错误", "参考API说明文档，修改参数；"));
        CODE_MAP.put(222013, new Node(222013, "param[image] format", "参数格式错误", "参考API说明文档，修改参数；"));
        CODE_MAP.put(222014, new Node(222014, "param[app_id] format", "参数格式错误", "参考API说明文档，修改参数；"));
        CODE_MAP.put(222015, new Node(222015, "param[image_type]", "参数格式错误", "参考API说明文档，修改参数；"));
        CODE_MAP.put(222016, new Node(222016, "param[max_face_num]", "参数格式错误", "参考API说明文档，修改参数；"));
        CODE_MAP.put(222017, new Node(222017, "param[face_field]", "参数格式错误", "参考API说明文档，修改参数；"));
        CODE_MAP.put(222018, new Node(222018, "param[user_id]", "参数格式错误", "参考API说明文档，修改参数；"));
        CODE_MAP.put(222019, new Node(222019, "param[quality_control]", "参数格式错误", "参考API说明文档，修改参数；"));
        CODE_MAP.put(222020, new Node(222020, "param[liveness_control]", "参数格式错误", "参考API说明文档，修改参数；"));
        CODE_MAP.put(222021, new Node(222021, "param[max_user_num]", "参数格式错误", "参考API说明文档，修改参数；"));
        CODE_MAP.put(222022, new Node(222022, "param[id_card_number]", "身份证号不符合要求，备注：中国大陆身份证号的每一位数字都有其生成规则，不可随意填写。", "填写正确的身份证号；"));
        CODE_MAP.put(222023, new Node(222023, "param[name] format error", "参数格式错误", "请检查手机号、姓名、身份证号格式是否正确"));
        CODE_MAP.put(222024, new Node(222024, "param[face_type]", "参数格式错误", "参考API说明文档，修改参数；"));
        CODE_MAP.put(222025, new Node(222025, "param[face_token]", "参数格式错误", "参考API说明文档，修改参数；"));
        CODE_MAP.put(222026, new Node(222026, "param[max_star_num] format error", "参数格式错误", "参考API说明文档，修改参数"));
        CODE_MAP.put(222027, new Node(222027, "code length param error", "验证码长度错误", "参考API说明文档，修改参数；"));
        CODE_MAP.put(222028, new Node(222028, "param[min_code_length] format error", "参数格式错误", "参考API说明文档，修改参数"));
        CODE_MAP.put(222029, new Node(222029, "param[max_code_length] format error", "参数格式错误", "参考API说明文档，修改参数"));
        CODE_MAP.put(222030, new Node(222030, "param[match_threshold] format error", "参数格式错误", "参考API说明文档，修改参数"));
        CODE_MAP.put(222039, new Node(222039, "param[face_sort_type] format error", "参数格式错误", "参考API说明文档，修改参数"));
        CODE_MAP.put(222200, new Node(222200, "request body should be json format", "该接口需使用", "请修改接口格式为：；application/json；"));
        CODE_MAP.put(222201, new Node(222201, "network not available", "服务端请求失败", "重新尝试"));
        CODE_MAP.put(222202, new Node(222202, "pic not has face", "图片中没有人脸", "检查图片质量"));
        CODE_MAP.put(222203, new Node(222203, "image check fail", "无法解析人脸", "检查图片质量"));
        CODE_MAP.put(222204, new Node(222204, "image_url_download_fail", "从图片的url下载", "请确认url可公网访问；"));
        CODE_MAP.put(222205, new Node(222205, "network not availablel", "服务端请求失败", "重新尝试"));
        CODE_MAP.put(222206, new Node(222206, "rtse service return fail", "服务端请求失败", "重新尝试"));
        CODE_MAP.put(222207, new Node(222207, "match user is not", "未找到匹配的用户", "请确认人脸库中；是否存在此用户"));
        CODE_MAP.put(222208, new Node(222208, "the number of image", "图片的数量错误", "多张图片请使用；json格式传输"));
        CODE_MAP.put(222209, new Node(222209, "face token not exist", "face token不存在", "请确认您操作的；人脸已创建成功；；若face_token未注册到；人脸库则有效期只有1小时；注册人脸库的；face_token永久有效"));
        CODE_MAP.put(222210, new Node(222210, "the number of user's faces is beyond the limit", "人脸库中用户下的人脸数目超过限制", "当前每个用户下限制人脸数目最大20张"));
        CODE_MAP.put(222213, new Node(222213, "face size is too small", "人脸尺寸过小，请保证人脸区域在64*64以上", "请重新尝试，；请重新上传符合人脸尺寸要求的图片"));
        CODE_MAP.put(222214, new Node(222214, "face are cartoon images", "请使用非卡通的人脸图像", "请重新尝试，；请重新上传非卡通的人脸图像"));
        CODE_MAP.put(222215, new Node(222215, "face quality is not acceptable", "人脸属性编辑处理该图像失败，请使用其他图片", "请使用其他图片重新上传"));
        CODE_MAP.put(222300, new Node(222300, "add face fail", "人脸图片添加失败", "重新尝试"));
        CODE_MAP.put(222301, new Node(222301, "get face fail", "获取人脸图片失败", "请重新尝试，；如果持续出现此类错误，；请提交工单"));
        CODE_MAP.put(222302, new Node(222302, "system error", "服务端请求失败", "重新尝试"));
        CODE_MAP.put(222303, new Node(222303, "get face fail", "获取人脸图片失败", "请重新尝试，；如果持续出现此类错误，请提交工单"));
        CODE_MAP.put(222309, new Node(222309, "image size is too small", "图片尺寸过小，请使用清晰的图片", "请重新尝试，；请重新上传符合尺寸要求的图片"));
        CODE_MAP.put(222152, new Node(222152, "param[target] format error", "人脸属性编辑，target参数错误", "请修改参数后重试"));
        CODE_MAP.put(222514, new Node(222514, "face editattrpro operation fail", "人脸属性编辑v2调用服务失败，请重试", "请重试"));
        CODE_MAP.put(223100, new Node(223100, "group is not exist", "操作的用户组不存在", "请确认您操作的；用户组已创建成功"));
        CODE_MAP.put(223101, new Node(223101, "group is already exist", "该用户组已存在", "请不要重复创建用户组"));
        CODE_MAP.put(223102, new Node(223102, "user is already exist", "该用户已存在", "请不要重复创建用户"));
        CODE_MAP.put(223103, new Node(223103, "user is not exist", "找不到该用户", "请确认您操作的；用户已创建成功"));
        CODE_MAP.put(223104, new Node(223104, "group_list is too large", "group_list包含组", "请按照文档提示；设置group_list参数"));
        CODE_MAP.put(223105, new Node(223105, "face is already exist", "该人脸已存在", "请不要重复添加人脸"));
        CODE_MAP.put(223106, new Node(223106, "face is not exist", "该人脸不存在", "请确认您操作的；人脸已创建成功；；若face_token未注册到；人脸库则有效期只有1小时，；注册人脸库的；face_token永久有效"));
        CODE_MAP.put(223107, new Node(223107, "scene_type not same", "人脸库中人脸复制时源组与目标组的scene_type不同", "scene_type不同的组之间用户不能复制"));
        CODE_MAP.put(223110, new Node(223110, "uid_list is too large", "uid_list包含数量过多", "请按照文档提示；设置user_list参数"));
        CODE_MAP.put(223111, new Node(223111, "dst group not exist", "目标用户组不存在", "请确认您操作的；用户组已创建成功"));
        CODE_MAP.put(223112, new Node(223112, "quality_conf format", "quality_conf格式不正确", "请按照文档提示设置；quality_conf参数"));
        CODE_MAP.put(223113, new Node(223113, "face is covered", "人脸有被遮挡", "提示用户请勿遮挡面部"));
        CODE_MAP.put(223114, new Node(223114, "face is fuzzy", "人脸模糊", "人脸图片模糊，；前端页面可以提示；用户拍摄时不要晃动手机"));
        CODE_MAP.put(223115, new Node(223115, "face light is not good", "人脸光照不好", "提示用户到光线适宜的地方拍摄"));
        CODE_MAP.put(223116, new Node(223116, "incomplete face", "人脸不完整", "提示用户请勿遮挡面部"));
        CODE_MAP.put(223117, new Node(223117, "app_list is too large", "app_list包含app数量", "请按照文档提示设置；app_list参数"));
        CODE_MAP.put(223118, new Node(223118, "quality control error", "质量控制项错误", "请按照文档提示设置；质量控制参数"));
        CODE_MAP.put(223119, new Node(223119, "liveness control item", "活体控制项错误", "请按照文档提示设置；活体控制参数"));
        CODE_MAP.put(223120, new Node(223120, "liveness check fail", "活体检测未通过", "此次活体检测结果为非活体"));
        CODE_MAP.put(223121, new Node(223121, "left eye is occlusion", "质量检测未通过 左眼", "提示用户请勿遮挡左眼；"));
        CODE_MAP.put(223122, new Node(223122, "right eye is occlusion", "质量检测未通过 右眼", "提示用户请勿遮挡右眼；"));
        CODE_MAP.put(223123, new Node(223123, "left cheek is occlusion", "质量检测未通过 左脸", "提示用户请勿遮挡左脸颊；"));
        CODE_MAP.put(223124, new Node(223124, "right cheek is", "质量检测未通过 右脸", "提示用户请勿遮挡右脸颊；"));
        CODE_MAP.put(223125, new Node(223125, "chin contour is", "质量检测未通过 下巴遮挡程度过高", "提示用户请勿遮挡下巴；"));
        CODE_MAP.put(223126, new Node(223126, "nose is occlusion", "质量检测未通过 鼻子遮挡程度过高", "提示用户请勿遮挡鼻子"));
        CODE_MAP.put(223127, new Node(223127, "mouth is occlusion", "质量检测未通过 嘴巴", "提示用户请勿遮挡嘴巴；"));
        CODE_MAP.put(222901, new Node(222901, "system busy", "参数校验初始化失败", "请重新尝试，；若尝试多次无效，；请提交工单咨询"));
        CODE_MAP.put(222902, new Node(222902, "system busy", "参数校验初始化失败", "请重新尝试，；若尝试多次无效，；请提交工单咨询"));
        CODE_MAP.put(222903, new Node(222903, "system busy", "参数校验初始化失败", "请重新尝试，；若尝试多次无效，；请提交工单咨询"));
        CODE_MAP.put(222904, new Node(222904, "system busy", "参数校验初始化失败", "请重新尝试，；若尝试多次无效，；请提交工单咨询"));
        CODE_MAP.put(222905, new Node(222905, "system busy", "接口初始化失败", "请重新尝试，；若尝试多次无效，；请提交工单咨询"));
        CODE_MAP.put(222906, new Node(222906, "system busy", "接口初始化失败", "请重新尝试，；若尝试多次无效，；请提交工单咨询"));
        CODE_MAP.put(222907, new Node(222907, "system busy", "缓存处理失败", "请重新尝试，；若尝试多次无效，；请提交工单咨询"));
        CODE_MAP.put(222908, new Node(222908, "system busy", "缓存处理失败", "请重新尝试，；若尝试多次无效，；请提交工单咨询"));
        CODE_MAP.put(222909, new Node(222909, "system busy", "缓存处理失败", "请重新尝试，；若尝试多次无效，；请提交工单咨询"));
        CODE_MAP.put(222910, new Node(222910, "system busy", "数据存储处理失败", "请重新尝试，；若尝试多次无效，；请提交工单咨询"));
        CODE_MAP.put(222911, new Node(222911, "system busy", "数据存储处理失败", "请重新尝试，；若尝试多次无效，；请提交工单咨询"));
        CODE_MAP.put(222912, new Node(222912, "system busy", "数据存储处理失败", "请重新尝试，；若尝试多次无效，；请提交工单咨询"));
        CODE_MAP.put(222913, new Node(222913, "system busy", "接口初始化失败", "请重新尝试，；若尝试多次无效，；请提交工单咨询"));
        CODE_MAP.put(222914, new Node(222914, "system busy", "接口初始化失败", "请重新尝试，；若尝试多次无效，；请提交工单咨询"));
        CODE_MAP.put(222915, new Node(222915, "system busy", "后端服务连接失败", "请重新尝试，；若尝试多次无效，；请提交工单咨询"));
        CODE_MAP.put(222916, new Node(222916, "system busy", "后端服务连接失败", "请重新尝试，；若尝试多次无效，；请提交工单咨询"));
        CODE_MAP.put(222304, new Node(222304, "image size is too large", "图片尺寸太大", "请确保图片尺寸在1920x1080以下"));
        CODE_MAP.put(222305, new Node(222305, "pic storage not support", "当前版本不支持图片存储", "请确认face_token的使用符合规范"));
        CODE_MAP.put(223128, new Node(223128, "group was deleting", "正在清理该用户组的数据", "请等该用户组清理完毕后再对；该组进行操作"));
        CODE_MAP.put(223136, new Node(223136, "images exist in this group", "该组内存在关联图片，无法新建相同名称组", "需清理完该组下的数据后才能创建组"));
        CODE_MAP.put(222361, new Node(222361, "system busy", "公安服务连接失败", "请重新尝试，；若尝试多次无效，；请提交工单咨询"));
        CODE_MAP.put(222046, new Node(222046, "param[template_type] format error", "参数格式错误", "请参考接口文档修改"));
        CODE_MAP.put(222101, new Node(222101, "param[merge_degree] format error", "参数格式错误", "请参考API说明文档，修改参数"));
        CODE_MAP.put(222102, new Node(222102, "param[face_location] format error", "参数格式错误", "参考API说明文档，修改参数"));
        CODE_MAP.put(222307, new Node(222307, "image illegal, reason: porn", "图片非法 鉴黄未通过", "请重新上传合法的图片"));
        CODE_MAP.put(222308, new Node(222308, "image illegal, reason: sensitive person", "图片非法 含有政治敏感人物", "请重新上传合法的图片"));
        CODE_MAP.put(222211, new Node(222211, "template image quality reject", "人脸融合失败 模板图质量不合格", "请检查模板图是否符合；人脸融合文档中的质量要求"));
        CODE_MAP.put(222212, new Node(222212, "merge face fail", "人脸融合失败", "请更换素材后重新尝试，；如果持续出现此类错误，请提交工单"));
        CODE_MAP.put(223129, new Node(223129, "face not forward", "人脸未面向正前方", "请使用面向正前方的人脸图片；"));
        CODE_MAP.put(223130, new Node(223130, "spoofing_control item error", "spoofing_control参数格式错误", "请求参数spoofing_control的值不是接口文档指定的[‘NONE’, ‘LOW’, ‘NORMAL’, ‘HIGH’] 其中之一，修改请求参数 spoofing_control 值"));
        CODE_MAP.put(223131, new Node(223131, "spoofing check fail", "合成图检测未通过", "此次活体检测结果为合成图攻击"));
        CODE_MAP.put(223133, new Node(223133, "video extract image liveness check fail", "视频提取图片活体检测失败", "视频可能存在活体攻击"));
        CODE_MAP.put(223052, new Node(223052, "action identify fail", "视频中的动作验证未通过", "请重新录制视频"));
        CODE_MAP.put(223201, new Node(223201, "param[scene_type] format error", "请求参数scene_type 格式错误", "请检查请求参数"));
        CODE_MAP.put(223202, new Node(223202, "scene_type does not match", "识别时请求的scene_type与group设置的scene_type不匹配", "检查请求参数 （此校验默认不开启）"));
    }

    @Data
    public static class Node {

        private Integer no;

        private String msgEn;

        private String msgCn;

        private String advice;

        public Node(Integer no, String msgEn, String msgCn, String advice) {
            this.no = no;
            this.msgEn = msgEn;
            this.msgCn = msgCn;
            this.advice = advice;
        }
    }
}
